import relationalStore from '@ohos.data.relationalStore';
import { ColumnInfo } from '../bean/ColumnInfo';
export interface RdbMapper {
  /**
   * 获取表名称
   * @returns
   */
  getDBName(): string;
  /**
   * 获取RDB实例
   * @param context
   * @returns
   */
  getRdb(context: any): Promise<RdbMapper>;
  /**
   * 执行sql语句
   * @param sql
   * @returns
   */
  executeSql(sql: string): Promise<void>;
  /**
   * 创建表
   * @param tableName
   * @param columns
   * @returns
   */
  createTable(tableName: string, columns: Array<ColumnInfo>): Promise<void>;
  /**
   * 删除表
   * @param tableName
   * @returns
   */
  deleteTable(tableName: string): Promise<void>;
  /**
   * 表中新增列
   * @param tableName
   * @param column
   * @returns
   */
  addTableColumn(tableName: string, column: ColumnInfo): Promise<void>;
  /**
   * 插入数据
   * @param tableName
   * @param values
   * @returns
   */
  insert(tableName: string, values: relationalStore.ValuesBucket | Array<relationalStore.ValuesBucket>): Promise<number>;
  /**
   * 根据条件更新数据
   * @param values
   * @param predicates
   * @returns
   */
  update(values: relationalStore.ValuesBucket, predicates: relationalStore.RdbPredicates): Promise<number>;
  /**
   * 根据条件查询数据
   * @param predicates
   * @param columns
   * @returns
   */
  query(predicates: relationalStore.RdbPredicates, columns?: Array<string>): Promise<relationalStore.ResultSet>;
  /**
   * 查询表中所有数据
   * @param tableName
   * @returns
   */
  queryAll(tableName: string): Promise<relationalStore.ResultSet>;
  /**
   * 根据sql语句查询数据
   * @param sql
   * @param bindArgs
   * @returns
   */
  queryBySql(sql: string, bindArgs?: Array<relationalStore.ValueType>): Promise<relationalStore.ResultSet>;
  /**
   * 根据条件删除数据
   * @param predicates
   * @returns
   */
  delete(predicates: relationalStore.RdbPredicates): Promise<number>;
}